VERSION 5.00
Begin VB.Form frmMateriales 
   Caption         =   "Materiales"
   ClientHeight    =   7095
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10005
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   12
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   7095
   ScaleWidth      =   10005
   StartUpPosition =   2  'CenterScreen
   WindowState     =   2  'Maximized
   Begin VB.Timer Timer1 
      Interval        =   100
      Left            =   7200
      Top             =   1080
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Command5"
      Default         =   -1  'True
      Height          =   285
      Left            =   3960
      TabIndex        =   12
      Top             =   -600
      Width           =   255
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   7920
      TabIndex        =   11
      Top             =   5760
      Width           =   1455
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Eliminar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6360
      TabIndex        =   10
      Top             =   5760
      Width           =   1455
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Modificar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4800
      TabIndex        =   9
      Top             =   5760
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Incluir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3240
      TabIndex        =   8
      Top             =   5760
      Width           =   1455
   End
   Begin VB.TextBox Text4 
      Height          =   405
      Left            =   5880
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   4800
      Width           =   3495
   End
   Begin VB.TextBox Text3 
      Height          =   405
      Left            =   5880
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   4200
      Width           =   3495
   End
   Begin VB.TextBox Text2 
      Height          =   405
      Left            =   5880
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   3600
      Width           =   3495
   End
   Begin VB.TextBox Text1 
      Height          =   405
      Left            =   5880
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   3000
      Width           =   2055
   End
   Begin VB.Label SkinLabel1 
      Height          =   495
      Left            =   3600
      TabIndex        =   0
      Top             =   3000
      Width           =   3495
   End
   Begin VB.Label SkinLabel2 
      Height          =   495
      Left            =   3600
      TabIndex        =   2
      Top             =   3600
      Width           =   3495
   End
   Begin VB.Label SkinLabel3 
      Height          =   495
      Left            =   3600
      TabIndex        =   4
      Top             =   4200
      Width           =   3495
   End
   Begin VB.Label SkinLabel4 
      Height          =   495
      Left            =   3600
      TabIndex        =   6
      Top             =   4800
      Width           =   3495
   End
End
Attribute VB_Name = "frmMateriales"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim tabla As DAO.Recordset
Sub Buscar()
    tabla.Index = "PrimaryKey"
    tabla.Seek "=", Text1.Text
    If tabla.NoMatch Then
        a = Text1.Text
        Limpiar
        Text1.Text = a
        Command1.Enabled = True
    Else
        mostrar
    End If
    
End Sub
Sub Limpiar()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Command1.Enabled = False
    Command2.Enabled = False
    Command3.Enabled = False
End Sub
Sub Guardar()
On Error Resume Next
    tabla(0) = Text1.Text
    tabla(1) = Text2.Text
    tabla(2) = Text3.Text
    tabla(3) = Text4.Text
End Sub
Sub mostrar()
On Error Resume Next
    Text1.Text = tabla(0)
    Text2.Text = tabla(1)
    Text3.Text = tabla(2)
    Text4.Text = tabla(3)
    Command1.Enabled = False
    Command2.Enabled = True
    Command3.Enabled = True
End Sub

Private Sub Command1_Click()
    tabla.AddNew
        Guardar
    tabla.Update
    Limpiar
    Text1.SetFocus
    
End Sub

Private Sub Command2_Click()
    tabla.Edit
        Guardar
    tabla.Update
    Limpiar
    Text1.SetFocus

End Sub

Private Sub Command3_Click()
    tabla.Delete
    Limpiar
    Text1.SetFocus
    

End Sub

Private Sub Command4_Click()
    Unload Me
End Sub

Private Sub Command5_Click()
    SendKeys "{TAB}"
End Sub

Private Sub Form_Load()
    Set tabla = Base.OpenRecordset("Almacen_Materiales")
    Limpiar
End Sub

Private Sub Text1_Validate(Cancel As Boolean)
    Buscar
End Sub

Private Sub Timer1_Timer()
    If Len(Text1.Text) > 0 Then
        Text2.SetFocus
        Command1.Enabled = True
        Timer1.Enabled = False
    End If
End Sub
